package com.chinaunicom.factory;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/11/24 14:29
 * Description:
 */
public class FactoryBeanMain {

	public static void main(String[] args) {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans-factorybean.xml");

		Car car = (Car) applicationContext.getBean("car");

		System.out.println("car 实例: " + car);


		// 获取工厂实例
		CarFactoryBean carFactoryBean = (CarFactoryBean) applicationContext.getBean("&car");
		System.out.println("CarFactoryBean 实例: " + carFactoryBean);

	}
}
